package com.gee.spring.boot.rpf.client.calculator.varialble.mblno;

import com.gee.spring.boot.rpf.client.calculator.Calculator;
import com.gee.spring.boot.rpf.client.BaseClientResponse;
import com.gee.spring.boot.rpf.util.sys.SysConfigUtil;
import com.gee.thread.flow.common.result.ExecuteState;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * desc:
 *
 * @author gee wrote on  2021-02-12 18:40:13
 */
@Component
public class MblNoCarrier implements Calculator {

    @Resource
    private SysConfigUtil sysConfigUtil;

    @Override
    public Object calculate(ExecuteState executeState, BaseClientResponse response, Class factorType, Object... otherParams) {
        if (otherParams == null || otherParams.length == 0){
            return "OTHER";
        }
        String mblNoCarrier = sysConfigUtil.getMblNoCarrier(otherParams[0].toString());
        return mblNoCarrier == null ? "OTHER" : mblNoCarrier;
    }
}
